package org.zy.thread;

import org.zy.model.Test;
import org.zy.model.Test1;

/**
 * @author Zhang Yu
 * @description: TODO
 * @date 2024/4/24 16:24
 */
public class ThreadDemo extends Thread{
    private Thread t;
    private String threadName;


    public ThreadDemo(String threadName) {
        this.threadName = threadName;
    }

    public void run(){
        System.out.println("Running " +  threadName );
        for (int i = 0; i < 5000; i++) {
            Test1.count++;
//            System.out.println("Thread " +  threadName + " adding.");
//            System.out.println("ThreadModel.count = " + test.getCount());

        }
        System.out.println("Thread " +  threadName + " exiting.");
    }

    public void start(){
//        System.out.println("Starting " +  threadName );
        if (t == null) {
            t = new Thread (this, threadName);
            t.start ();
        }
    }
}
